7  Appendix D

7.1 Setup

7.1.1 Install Packages

We install the following packages using the groundhog package manager to increase computational reproducibility.

options(repos = c(CRAN = "https://cran.r-project.org")) 

if (!requireNamespace("groundhog", quietly = TRUE)) {
    install.packages("groundhog")
    library("groundhog")
}

pkgs <- c("magrittr", "data.table", "ggplot2", "ggsignif")

groundhog::groundhog.library(pkg = pkgs,
                             date = "2023-09-25")

7.1.2 Read Data

data      <- readRDS(file="../data/processed/full.Rda")

7.1.3 Design

We define some design features in the following:

colors <- c("#F3B05C", "#1E4A75", "#65B5C0", "#AD5E21")

layout <- theme(panel.background = element_rect(fill = "white"),
                legend.key = element_rect(fill = "white"),
                panel.grid.major.y = element_line(colour = "grey", 
                                                  linewidth = 0.25),
                axis.ticks.y = element_blank(),
                panel.grid.major.x = element_blank(),
                axis.line.x.bottom = element_line(colour = "#000000", 
                                                  linewidth = 0.5),
                axis.line.y.left = element_blank(),
                plot.title = element_text(size = rel(1))
)

7.2 Figure a

wilcox_test <- wilcox.test(formula = credibility ~ surprise, 
                           data = data[treated == 1])

p_value <- wilcox_test$p.value
p_value_text <- ifelse(p_value < 0.01, "***", ifelse(p_value < 0.05, "**", ifelse(p_value < 0.10, "*", "ns")))
formatted_p_value <- format(x = p_value, digits = 3, scientific = TRUE)

ggplot(data = data[treated == 1],
       mapping = aes(y = credibility,
                     x = surprise)) +
  geom_bar(stat = "summary", 
           fun = mean,
           fill = colors[2]) +
  scale_y_continuous(limits = c(0, 4),
                     expand = c(0, NA)) +
  geom_signif(comparisons = list(c("FALSE", "TRUE")),
              annotations = paste0(formatted_p_value, " (", p_value_text, ")"),
              y_position = 3.5,
              tip_length = 0,
              size = 0.5) +
  labs(x = "Contradiction",
       y = "Credibility") +
  layout

Figure 7.1: Credibility, confirmation compared to contradiction

7.3 Figure c

comparisons <- list(c("point", "interval"), 
                    c("point", "both"), 
                    c("interval", "both"))

p_values <- sapply(comparisons, function(comp) {
  test <- wilcox.test(formula = credibility ~ communication, 
                      data = data[treated == 1 & surprise == FALSE & communication %in% comp])
  test$p.value
})

p_values_text <- sapply(p_values, function(p) {
  ifelse(p < 0.01, "***", ifelse(p < 0.05, "**", ifelse(p < 0.10, "*", "ns")))
})

formatted_p_values <- format(x = p_values, digits = 3, scientific = TRUE)

ggplot(data = data[treated == 1 & surprise == FALSE],
       mapping = aes(y = credibility,
                     x = communication)) +
  geom_bar(stat = "summary", 
           fun = mean,
           fill = colors[2]) +
  scale_y_continuous(limits = c(0, 4),
                     expand = c(0, NA)) +
  geom_signif(comparisons = comparisons,
              annotations = paste0(formatted_p_values, " (", p_values_text, ")"),
              y_position = c(3.0, 3.3, 3.6),
              tip_length = 0,
              size = 0.5) +
  labs(x = "Communication",
       y = "Credibility") +
  layout

Figure 7.2: Credibility, confirmation treatments

7.4 Figure e

comparisons <- list(c("point", "interval"), 
                    c("point", "both"), 
                    c("interval", "both"))

p_values <- sapply(comparisons, function(comp) {
  test <- wilcox.test(formula = credibility ~ communication, 
                      data = data[treated == 1 & surprise == TRUE & communication %in% comp])
  test$p.value
})

p_values_text <- sapply(p_values, function(p) {
  ifelse(p < 0.01, "***", ifelse(p < 0.05, "**", ifelse(p < 0.10, "*", "ns")))
})

formatted_p_values <- format(x = p_values, digits = 3, scientific = TRUE)

ggplot(data = data[treated == 1 & surprise == TRUE],
       mapping = aes(y = credibility,
                     x = communication)) +
  geom_bar(stat = "summary", 
           fun = mean,
           fill = colors[2]) +
  scale_y_continuous(limits = c(0, 4),
                     expand = c(0, NA)) +
  geom_signif(comparisons = comparisons,
              annotations = paste0(formatted_p_values, " (", p_values_text, ")"),
              y_position = c(3.0, 3.3, 3.6),
              tip_length = 0,
              size = 0.5) +
  labs(x = "Communication",
       y = "Credibility") +
  layout

Figure 7.3: Credibility, contradiction treatments

7.5 Figure b

ggplot(data = data[treated == 1],
       mapping = aes(x = credibility, fill = surprise)) +
  geom_histogram(aes(y = after_stat(density)), 
                 alpha = 0.66,
                 position = "identity", 
                 binwidth = 1, 
                 color = "black") +
  scale_y_continuous(limits = c(0, 0.5),
                     expand = c(0, NA)) +
  labs(x = "Credibility",
       y = "Density") +
  layout

Figure 7.4: Credibility, confirmation compared to contradiction (density)

7.6 Figure d

ggplot(data = data[treated == 1 & surprise == FALSE],
       mapping = aes(x = credibility, fill = communication)) +
  geom_histogram(aes(y = after_stat(density)), 
                 alpha = 0.66,
                 position = "identity", 
                 binwidth = 1, 
                 color = "black") +
  scale_y_continuous(limits = c(0, 0.5),
                     expand = c(0, NA)) +
  labs(x = "Credibility",
       y = "Density") +
  layout

Figure 7.5: Credibility, confirmation treatments (density)

7.7 Figure f

ggplot(data = data[treated == 1 & surprise == TRUE],
       mapping = aes(x = credibility, fill = communication)) +
  geom_histogram(aes(y = after_stat(density)), 
                 alpha = 0.66,
                 position = "identity", 
                 binwidth = 1, 
                 color = "black") +
  scale_y_continuous(limits = c(0, 0.5),
                     expand = c(0, NA)) +
  labs(x = "Credibility",
       y = "Density") +
  layout

Figure 7.6: Credibility, contradiction treatments